﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace smarx.HostedWebCore
{
    public class HWCServer
    {
        private string applicationHostConfig;
        private string webConfig;

        public HWCServer(string applicationHostConfig, string webConfig)
        {
            this.applicationHostConfig = applicationHostConfig;
            this.webConfig = webConfig;
        }

        public void Start()
        {
            int result = HWCPInterop.WebCoreActivate(applicationHostConfig, webConfig, Guid.NewGuid().ToString());
            if (result != 0) Marshal.ThrowExceptionForHR(result);
        }

        public void Stop()
        {
            int result = HWCPInterop.WebCoreShutdown(true);
            if (result != 0) Marshal.ThrowExceptionForHR(result);
        }
    }
}